package hlhj.fhp.supreme.adapters

import android.support.v4.app.Fragment
import android.support.v4.app.FragmentManager
import android.support.v4.app.FragmentPagerAdapter
import android.view.ViewGroup
import hlhj.fhp.supreme.fragment.JiePanListFgm
import hlhj.fhp.supreme.fragment.MyJiePanListFgm
import hlhj.fhp.supreme.fragment.SpendHisFgm

/**
 * Created by Never Fear   on 2018\7\17 0017.
Never More....
 */
class JiePanPagerAdp(private val lists:ArrayList<Fragment>,fm:FragmentManager) :FragmentPagerAdapter(fm) {
    override fun getItem(position: Int): Fragment {
        return lists[position]
    }

    override fun getCount(): Int {
        return lists.size
    }

    override fun destroyItem(container: ViewGroup?, position: Int, `object`: Any?) {
//        super.destroyItem(container, position, `object`)
    }

    override fun getPageTitle(position: Int): CharSequence {
        val fragment = lists[position]
        if (fragment is JiePanListFgm){
            return fragment.arguments.getString("name")
        }else if (fragment is MyJiePanListFgm){
            return fragment.arguments.getString("name")
        }else if (fragment is SpendHisFgm){
            return fragment.arguments.getString("name")
        }
        return "测试"
    }
}